<!DOCTYPE html>
<html lang="en">
  <head>
    <title>HTTPServer Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset="utf-8">
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>

    <a name="//apple_ref/swift/Class/HTTPServer" class="dashAnchor"></a>

    <a title="HTTPServer Class Reference"></a>

    <header class="header">
      <p class="header-col header-col--primary">
        <a class="header-link" href="../index.html">
          PerfectLib Docs
        </a>
         (70% documented)
      </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="https://github.com/PerfectlySoft/Perfect">
            <img class="header-icon" src="../img/gh.png"/>
            View on GitHub
          </a>
        </p>
    
    </header>

    <p class="breadcrumbs">
      <a class="breadcrumb" href="../index.html">PerfectLib Reference</a>
      <img class="carat" src="../img/carat.png" />
      HTTPServer Class Reference
    </p>

    <div class="content-wrapper">
      <nav class="navigation">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/Bytes.html">Bytes</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/File.html">File</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/File/OpenMode.html">– OpenMode</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/HTTP2Client.html">HTTP2Client</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/HTTPServer.html">HTTPServer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/JSONConvertibleObject.html">JSONConvertibleObject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/JSONDecoding.html">JSONDecoding</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MimeReader.html">MimeReader</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MimeReader/BodySpec.html">– BodySpec</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheEvaluationContext.html">MustacheEvaluationContext</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheEvaluationOutputCollector.html">MustacheEvaluationOutputCollector</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheGroupTag.html">MustacheGroupTag</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheParser.html">MustacheParser</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustachePartialTag.html">MustachePartialTag</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustachePragmaTag.html">MustachePragmaTag</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheTag.html">MustacheTag</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/MustacheTemplate.html">MustacheTemplate</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/SysProcess.html">SysProcess</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Classes/TemporaryFile.html">TemporaryFile</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Global Variables.html#/s:v10PerfectLib10fileStderrCS_4File">fileStderr</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Global Variables.html#/s:v10PerfectLib9fileStdinCS_4File">fileStdin</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Global Variables.html#/s:v10PerfectLib10fileStdoutCS_4File">fileStdout</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Global Variables.html#/s:v10PerfectLib22serverPerfectLibrariesSS">serverPerfectLibraries</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Enums.html">Enums</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPFilterPriority.html">HTTPFilterPriority</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPMethod.html">HTTPMethod</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPRequestFilterResult.html">HTTPRequestFilterResult</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPRequestHeader.html">HTTPRequestHeader</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPRequestHeader/Name.html">– Name</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPResponseFilterResult.html">HTTPResponseFilterResult</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPResponseHeader.html">HTTPResponseHeader</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPResponseHeader/Name.html">– Name</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/HTTPResponseStatus.html">HTTPResponseStatus</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/JSONConversionError.html">JSONConversionError</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/MustacheError.html">MustacheError</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Enums/PerfectError.html">PerfectError</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Array.html">Array</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Bool.html">Bool</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Dictionary.html">Dictionary</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Double.html">Double</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Int.html">Int</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/NetNamedPipe.html">NetNamedPipe</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/Optional.html">Optional</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/String.html">String</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/UInt.html">UInt</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Extensions/UnicodeScalar.html">UnicodeScalar</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Functions.html">Functions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:ZF10PerfectLiboi2eeFTOOS_17HTTPRequestHeader4NameS1__Sb">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:ZF10PerfectLiboi2eeFTOOS_18HTTPResponseHeader4NameS1__Sb">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:ZF10PerfectLiboi2eeFTOS_10HTTPMethodS0__Sb">==(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib10empty_uuidFT_TVs5UInt8S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0__">empty_uuid()</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib10formatDateFzTSd6formatSS8timezoneGSqSS_6localeGSqSS__SS">formatDate(_:format:timezone:locale:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib6getNowFT_Sd">getNow()</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib16icuDateToSecondsFSdSi">icuDateToSeconds(_:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib15mustacheRequestFT7requestPS_11HTTPRequest_8responsePS_12HTTPResponse_7handlerPS_19MustachePageHandler_12templatePathSS_T_">mustacheRequest(request:response:handler:templatePath:)</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib11random_uuidFT_TVs5UInt8S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0__">random_uuid()</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Functions.html#/s:F10PerfectLib16secondsToICUDateFSiSd">secondsToICUDate(_:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/HTTPRequest.html">HTTPRequest</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/HTTPRequestFilter.html">HTTPRequestFilter</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/HTTPResponse.html">HTTPResponse</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/HTTPResponseFilter.html">HTTPResponseFilter</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/HeaderListener.html">HeaderListener</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/JSONConvertible.html">JSONConvertible</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Protocols/MustachePageHandler.html">MustachePageHandler</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="../Structs.html">Structs</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/Dir.html">Dir</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/Encoding.html">Encoding</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/GenerateFromPointer.html">GenerateFromPointer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/HTTPCookie.html">HTTPCookie</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/HTTPCookie/Expiration.html">– Expiration</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/JSONConvertibleNull.html">JSONConvertibleNull</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs.html#/s:V10PerfectLib3Log">Log</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/MimeType.html">MimeType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/MimeType/TopType.html">– TopType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/PerfectServer.html">PerfectServer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/RouteMap.html">RouteMap</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/Routing.html">Routing</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/StaticFileHandler.html">StaticFileHandler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="../Structs/UTF8Encoding.html">UTF8Encoding</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">

        <section class="section">
          <div class="section-content">
            <h1>HTTPServer</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">HTTPServer</span></code></pre>

                </div>
              </div>
            <p>Stand-alone HTTP server. Provides the same WebConnection based interface as the FastCGI server.</p>

          </div>
        </section>

        <section class="section">
          <div class="section-content">
            <div class="task-group">
              <ul class="item-container">
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC10PerfectLib10HTTPServer12documentRootSS"></a>
                    <a name="//apple_ref/swift/Property/documentRoot" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC10PerfectLib10HTTPServer12documentRootSS">documentRoot</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The directory in which web documents are sought.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">documentRoot</span><span class="p">:</span> <span class="kt">String</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC10PerfectLib10HTTPServer10serverPortVs6UInt16"></a>
                    <a name="//apple_ref/swift/Property/serverPort" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC10PerfectLib10HTTPServer10serverPortVs6UInt16">serverPort</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The port on which the server is listening.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">serverPort</span><span class="p">:</span> <span class="kt">UInt16</span> <span class="o">=</span> <span class="mi">0</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC10PerfectLib10HTTPServer13serverAddressSS"></a>
                    <a name="//apple_ref/swift/Property/serverAddress" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC10PerfectLib10HTTPServer13serverAddressSS">serverAddress</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The local address on which the server is listening. The default of 0.0.0.0 indicates any local address.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">serverAddress</span> <span class="o">=</span> <span class="s">"0.0.0.0"</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC10PerfectLib10HTTPServer9runAsUserGSqSS_"></a>
                    <a name="//apple_ref/swift/Property/runAsUser" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC10PerfectLib10HTTPServer9runAsUserGSqSS_">runAsUser</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Switch to user after binding port</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">runAsUser</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC10PerfectLib10HTTPServer10serverNameSS"></a>
                    <a name="//apple_ref/swift/Property/serverName" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC10PerfectLib10HTTPServer10serverNameSS">serverName</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The canonical server name.
This is important if utilizing the <code>WebRequest.serverName</code> <q>SERVER_NAME</q> variable.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">serverName</span> <span class="o">=</span> <span class="s">""</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServercFT12documentRootSS_S0_"></a>
                    <a name="//apple_ref/swift/Method/init(documentRoot:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServercFT12documentRootSS_S0_">init(documentRoot:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initialize the server with a document root.
- parameter documentRoot: The document root for the server.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">documentRoot</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>documentRoot</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The document root for the server.</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServer17setRequestFiltersFGSaTPS_17HTTPRequestFilter_OS_18HTTPFilterPriority__S0_"></a>
                    <a name="//apple_ref/swift/Method/setRequestFilters(_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServer17setRequestFiltersFGSaTPS_17HTTPRequestFilter_OS_18HTTPFilterPriority__S0_">setRequestFilters(_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Set the request filters. Each is provided along with its priority.
The filters can be provided in any order. High priority filters will be sorted able lower priorities.
Filters of equal priority will maintain the order given here.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">setRequestFilters</span><span class="p">(</span><span class="n">_</span> <span class="nv">request</span><span class="p">:</span> <span class="p">[(</span><span class="kt"><a href="../Protocols/HTTPRequestFilter.html">HTTPRequestFilter</a></span><span class="p">,</span> <span class="kt"><a href="../Enums/HTTPFilterPriority.html">HTTPFilterPriority</a></span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">HTTPServer</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServer18setResponseFiltersFGSaTPS_18HTTPResponseFilter_OS_18HTTPFilterPriority__S0_"></a>
                    <a name="//apple_ref/swift/Method/setResponseFilters(_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServer18setResponseFiltersFGSaTPS_18HTTPResponseFilter_OS_18HTTPFilterPriority__S0_">setResponseFilters(_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Set the response filters. Each is provided along with its priority.
The filters can be provided in any order. High priority filters will be sorted able lower priorities.
Filters of equal priority will maintain the order given here.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">setResponseFilters</span><span class="p">(</span><span class="n">_</span> <span class="nv">response</span><span class="p">:</span> <span class="p">[(</span><span class="kt"><a href="../Protocols/HTTPResponseFilter.html">HTTPResponseFilter</a></span><span class="p">,</span> <span class="kt"><a href="../Enums/HTTPFilterPriority.html">HTTPFilterPriority</a></span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">HTTPServer</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServer5startFzT4portVs6UInt1611bindAddressSS_T_"></a>
                    <a name="//apple_ref/swift/Method/start(port:bindAddress:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServer5startFzT4portVs6UInt1611bindAddressSS_T_">start(port:bindAddress:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Start the server on the indicated TCP port and optional address.
- parameter port: The port on which to bind.
- parameter bindAddress: The local address on which to bind.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">start</span><span class="p">(</span><span class="nv">port</span><span class="p">:</span> <span class="kt">UInt16</span><span class="p">,</span> <span class="nv">bindAddress</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"0.0.0.0"</span><span class="p">)</span> <span class="k">throws</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>port</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The port on which to bind.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>bindAddress</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The local address on which to bind.</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServer5startFzT4portVs6UInt167sslCertSS6sslKeySS8dhParamsGSqSS_11bindAddressSS_T_"></a>
                    <a name="//apple_ref/swift/Method/start(port:sslCert:sslKey:dhParams:bindAddress:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServer5startFzT4portVs6UInt167sslCertSS6sslKeySS8dhParamsGSqSS_11bindAddressSS_T_">start(port:sslCert:sslKey:dhParams:bindAddress:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Start the server on the indicated TCP port and optional address.
- parameter port: The port on which to bind.
- parameter sslCert: The server SSL certificate file.
- parameter sslKey: The server SSL key file.
- parameter bindAddress: The local address on which to bind.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">start</span><span class="p">(</span><span class="nv">port</span><span class="p">:</span> <span class="kt">UInt16</span><span class="p">,</span> <span class="nv">sslCert</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">sslKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">dhParams</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">bindAddress</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"0.0.0.0"</span><span class="p">)</span> <span class="k">throws</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>port</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The port on which to bind.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>sslCert</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The server SSL certificate file.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>sslKey</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The server SSL key file.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>bindAddress</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The local address on which to bind.</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC10PerfectLib10HTTPServer4stopFT_T_"></a>
                    <a name="//apple_ref/swift/Method/stop()" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC10PerfectLib10HTTPServer4stopFT_T_">stop()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Stop the server by closing the accepting TCP socket. Calling this will cause the server to break out of the otherwise blocking <code>start</code> function.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">stop</span><span class="p">()</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </section>

      </article>
    </div>
    <section class="footer">
      <p>© 2016 PerfectlySoft Inc. and the Perfect project authors</p>
      <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
    </section>
  </body>
</div>
</html>
